<template>
  <div>
    <p>Child</p>
    <p>count is {{ count }}</p>
    <button @click="changeParent">改父组件的值</button>&nbsp;&nbsp;
    <button @click="changeGrandpa">改爷爷组件的值</button>
  </div>
</template>

<script>
// 导出的是子组件的实例
export default {
  data () {
    return {
      count: 100
    }
  },
  methods: {
    clickMe () {
      alert('---clickMe---')
    },
    changeParent () {
      //   console.log(this.$parent)
      this.$parent.name = '李四'
    },
    changeGrandpa () {
      this.$parent.$parent.address = '广东广州'
    }
  }
}
</script>
